home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 April: Mac OS SDK / Dev.CD Apr 99 SDK1.toast / Development Kits / Interfaces&Libraries / Universal / Interfaces / CIncludes / Start.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-17  |  11.4 KB  |  320 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Start.h
  3.  
  4.      Contains:    Start Manager Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    Universal Interfaces 3.2
  8.  
  9.      Copyright:    © 1987-1993, 1996-1998 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __START__
  18. #define __START__
  19.  
  20. #ifndef __MACTYPES__
  21. #include <MacTypes.h>
  22. #endif
  23. #ifndef __FILES__
  24. #include <Files.h>
  25. #endif
  26.  
  27.  
  28.  
  29. #if PRAGMA_ONCE
  30. #pragma once
  31. #endif
  32.  
  33. #ifdef __cplusplus
  34. extern "C" {
  35. #endif
  36.  
  37. #if PRAGMA_IMPORT
  38. #pragma import on
  39. #endif
  40.  
  41. #if PRAGMA_STRUCT_ALIGN
  42.     #pragma options align=mac68k
  43. #elif PRAGMA_STRUCT_PACKPUSH
  44.     #pragma pack(push, 2)
  45. #elif PRAGMA_STRUCT_PACK
  46.     #pragma pack(2)
  47. #endif
  48.  
  49. /*
  50.     Important: When the major version number of kExtensionTableVersion and the value
  51.     returned by gestaltExtensionTableVersion change, it indicates that the Extension
  52.     Table startup mechanism has radically changed and code that doesn't know about
  53.     the new major version must not attempt to use the Extension Table startup
  54.     mechanism.
  55.     
  56.     Changes to the minor version number of kExtensionTableVersion indicate that the
  57.     definition of the ExtensionElement structure has been extended, but the fields
  58.     defined for previous minor versions of kExtensionTableVersion have not changed.
  59. */
  60.  
  61. enum {
  62.     kExtensionTableVersion        = 0x00000100                    /* current ExtensionTable version (1.0.0) */
  63. };
  64.  
  65. /* ExtensionNotification message codes */
  66.  
  67. enum {
  68.     extNotificationBeforeFirst    = 0,                            /* Before any extensions have loaded */
  69.     extNotificationAfterLast    = 1,                            /* After all extensions have loaded */
  70.     extNotificationBeforeCurrent = 2,                            /* Before extension at extElementIndex is loaded */
  71.     extNotificationAfterCurrent    = 3                                /* After extension at extElementIndex is loaded */
  72. };
  73.  
  74.  
  75. struct ExtensionElement {
  76.     Str31                             fileName;                    /* The file name */
  77.     long                             parentDirID;                /* the file's parent directory ID */
  78.                                                                 /* and everything after ioNamePtr in the HParamBlockRec.fileParam variant */
  79.     short                             ioVRefNum;                    /* always the real volume reference number (not a drive, default, or working dirID) */
  80.     short                             ioFRefNum;
  81.     SInt8                             ioFVersNum;
  82.     SInt8                             filler1;
  83.     short                             ioFDirIndex;                /* always 0 in table */
  84.     SInt8                             ioFlAttrib;
  85.     SInt8                             ioFlVersNum;
  86.     FInfo                             ioFlFndrInfo;
  87.     long                             ioDirID;
  88.     unsigned short                     ioFlStBlk;
  89.     long                             ioFlLgLen;
  90.     long                             ioFlPyLen;
  91.     unsigned short                     ioFlRStBlk;
  92.     long                             ioFlRLgLen;
  93.     long                             ioFlRPyLen;
  94.     unsigned long                     ioFlCrDat;
  95.     unsigned long                     ioFlMdDat;
  96. };
  97. typedef struct ExtensionElement            ExtensionElement;
  98. typedef ExtensionElement *                ExtensionElementPtr;
  99.  
  100. struct ExtensionTableHeader {
  101.     UInt32                             extTableHeaderSize;            /* size of ExtensionTable header ( equal to offsetof(ExtensionTable, extElements[0]) ) */
  102.     UInt32                             extTableVersion;            /* current ExtensionTable version (same as returned by gestaltExtTableVersion Gestalt selector) */
  103.     UInt32                             extElementIndex;            /* current index into ExtensionElement records (zero-based) */
  104.     UInt32                             extElementSize;                /* size of ExtensionElement */
  105.     UInt32                             extElementCount;            /* number of ExtensionElement records in table (1-based) */
  106. };
  107. typedef struct ExtensionTableHeader        ExtensionTableHeader;
  108.  
  109. struct ExtensionTable {
  110.     ExtensionTableHeader             extTableHeader;                /* the ExtensionTableHeader */
  111.     ExtensionElement                 extElements[1];                /* one element for each extension to load */
  112. };
  113. typedef struct ExtensionTable            ExtensionTable;
  114. typedef ExtensionTable *                ExtensionTablePtr;
  115. typedef ExtensionTablePtr *                ExtensionTableHandle;
  116. typedef CALLBACK_API( void , ExtensionNotificationProcPtr )(UInt32 message, void *param, ExtensionElementPtr extElement);
  117. typedef CALLBACK_API( void , ExtensionTableHandlerProcPtr )(UInt32 message, void *param, ExtensionTableHandle extTableHandle);
  118. typedef STACK_UPP_TYPE(ExtensionNotificationProcPtr)             ExtensionNotificationUPP;
  119. typedef STACK_UPP_TYPE(ExtensionTableHandlerProcPtr)             ExtensionTableHandlerUPP;
  120. enum { uppExtensionNotificationProcInfo = 0x00000FC0 };         /* pascal no_return_value Func(4_bytes, 4_bytes, 4_bytes) */
  121. enum { uppExtensionTableHandlerProcInfo = 0x00000FC0 };         /* pascal no_return_value Func(4_bytes, 4_bytes, 4_bytes) */
  122. #define NewExtensionNotificationProc(userRoutine)                 (ExtensionNotificationUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppExtensionNotificationProcInfo, GetCurrentArchitecture())
  123. #define NewExtensionTableHandlerProc(userRoutine)                 (ExtensionTableHandlerUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppExtensionTableHandlerProcInfo, GetCurrentArchitecture())
  124. #define CallExtensionNotificationProc(userRoutine, message, param, extElement)  CALL_THREE_PARAMETER_UPP((userRoutine), uppExtensionNotificationProcInfo, (message), (param), (extElement))
  125. #define CallExtensionTableHandlerProc(userRoutine, message, param, extTableHandle)  CALL_THREE_PARAMETER_UPP((userRoutine), uppExtensionTableHandlerProcInfo, (message), (param), (extTableHandle))
  126.  
  127. union DefStartRec {
  128.     struct {
  129.         SignedByte                         sdExtDevID;
  130.         SignedByte                         sdPartition;
  131.         SignedByte                         sdSlotNum;
  132.         SignedByte                         sdSRsrcID;
  133.     }                                 slotDev;
  134.     struct {
  135.         SignedByte                         sdReserved1;
  136.         SignedByte                         sdReserved2;
  137.         short                             sdRefNum;
  138.     }                                 scsiDev;
  139. };
  140. typedef union DefStartRec                DefStartRec;
  141.  
  142. typedef DefStartRec *                    DefStartPtr;
  143.  
  144. struct DefVideoRec {
  145.     SignedByte                         sdSlot;
  146.     SignedByte                         sdsResource;
  147. };
  148. typedef struct DefVideoRec                DefVideoRec;
  149.  
  150. typedef DefVideoRec *                    DefVideoPtr;
  151.  
  152. struct DefOSRec {
  153.     SignedByte                         sdReserved;
  154.     SignedByte                         sdOSType;
  155. };
  156. typedef struct DefOSRec                    DefOSRec;
  157.  
  158. typedef DefOSRec *                        DefOSPtr;
  159.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  160.                                                                                             #pragma parameter GetDefaultStartup(__A0)
  161.                                                                                             #endif
  162. EXTERN_API( void )
  163. GetDefaultStartup                (DefStartPtr             paramBlock)                            ONEWORDINLINE(0xA07D);
  164.  
  165.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  166.                                                                                             #pragma parameter SetDefaultStartup(__A0)
  167.                                                                                             #endif
  168. EXTERN_API( void )
  169. SetDefaultStartup                (DefStartPtr             paramBlock)                            ONEWORDINLINE(0xA07E);
  170.  
  171.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  172.                                                                                             #pragma parameter GetVideoDefault(__A0)
  173.                                                                                             #endif
  174. EXTERN_API( void )
  175. GetVideoDefault                    (DefVideoPtr             paramBlock)                            ONEWORDINLINE(0xA080);
  176.  
  177.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  178.                                                                                             #pragma parameter SetVideoDefault(__A0)
  179.                                                                                             #endif
  180. EXTERN_API( void )
  181. SetVideoDefault                    (DefVideoPtr             paramBlock)                            ONEWORDINLINE(0xA081);
  182.  
  183.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  184.                                                                                             #pragma parameter GetOSDefault(__A0)
  185.                                                                                             #endif
  186. EXTERN_API( void )
  187. GetOSDefault                    (DefOSPtr                 paramBlock)                            ONEWORDINLINE(0xA084);
  188.  
  189.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  190.                                                                                             #pragma parameter SetOSDefault(__A0)
  191.                                                                                             #endif
  192. EXTERN_API( void )
  193. SetOSDefault                    (DefOSPtr                 paramBlock)                            ONEWORDINLINE(0xA083);
  194.  
  195. EXTERN_API( void )
  196. SetTimeout                        (short                     count);
  197.  
  198. EXTERN_API( void )
  199. GetTimeout                        (short *                count);
  200.  
  201. /*
  202.     InstallExtensionNotificationProc
  203.  
  204.     Installs an ExtensionNotificationUPP.
  205.  
  206.     Parameters:
  207.         extNotificationProc    The ExtensionNotificationUPP to install.
  208.  
  209.     Results:
  210.         noErr        0        The ExtensionNotificationUPP was installed.
  211.         paramErr    -50        This ExtensionNotificationUPP has already been installed.
  212.         memFullErr    -108    Not enough memory to install the ExtensionNotificationUPP.
  213. */
  214. EXTERN_API( OSErr )
  215. InstallExtensionNotificationProc (ExtensionNotificationUPP  extNotificationProc)            TWOWORDINLINE(0x7000, 0xAA7D);
  216.  
  217.  
  218. /*
  219.     RemoveExtensionNotificationProc
  220.  
  221.     Removes an ExtensionNotificationUPP.
  222.     
  223.     Note:    ExtensionNotificationUPPs can't call RemoveExtensionNotificationProc.
  224.  
  225.     Parameters:
  226.         extNotificationProc    The ExtensionNotificationUPP to remove.
  227.  
  228.     Results:
  229.         noErr        0        The ExtensionNotificationUPP was removed.
  230.         paramErr    -50        The ExtensionNotificationUPP was not found, or
  231.                             RemoveExtensionNotificationProc was called from within
  232.                             a ExtensionNotificationUPP (ExtensionNotificationUPPs can't
  233.                             call RemoveExtensionNotificationProc).
  234. */
  235. EXTERN_API( OSErr )
  236. RemoveExtensionNotificationProc    (ExtensionNotificationUPP  extNotificationProc)                TWOWORDINLINE(0x7001, 0xAA7D);
  237.  
  238.  
  239. /*
  240.     InstallExtensionTableHandlerProc
  241.  
  242.     Installs an ExtensionTableHandlerUPP. Control is taken away from the system's default
  243.     handler and the ExtensionTableHandlerUPP is responsible for all changes to the
  244.     ExtensionTable (except for incrementing extElementIndex between extensions). This is
  245.     always the first handler called with extNotificationBeforeFirst and
  246.     extNotificationBeforeCurrent messages and the last handler called with
  247.     extNotificationAfterLast and extNotificationAfterCurrent messages. extElementIndex
  248.     is always incremented immediately after the ExtensionTableHandlerUPP is called with
  249.     the extNotificationAfterCurrent message.
  250.     
  251.     There can only be one ExtensionTableHandler installed.
  252.     
  253.     Warning:    The only safe time to change what ExtensionElement is at
  254.                 ExtensionTable.extElements[extElementIndex] is when your
  255.                 ExtensionTableHandlerUPP is called with the extNotificationAfterCurrent
  256.                 message. You may change the ExtensionTable or the extElementIndex at other
  257.                 times, but you must ensure that the ExtensionElement at
  258.                 ExtensionTable.extElements[extElementIndex] stays the same.
  259.                 
  260.     Note:        If the ExtensionTable or the contents of the folders included in the
  261.                 ExtensionTable are changed after installing an ExtensionTableHandler,
  262.                 RemoveExtensionTableHandlerProc cannot be called.
  263.  
  264.     Parameters:
  265.         extMgrProc            The ExtensionTableHandlerUPP to install.
  266.         extTable            A pointer to an ExtensionTableHandle where
  267.                             InstallExtensionTableHandlerProc will return the current
  268.                             ExtensionTableHandle. You don't own the handle itself and
  269.                             must not dispose of it, but you can change the extElementIndex.
  270.                             the extElementCount, and the ExtensionElements in the table.
  271.  
  272.     Results:
  273.         noErr        0        The ExtensionTableHandlerUPP was installed.
  274.         paramErr    -50        Another ExtensionTableHandlerUPP has already been installed.
  275.         memFullErr    -108    Not enough memory to install the ExtensionTableHandlerUPP.
  276. */
  277. EXTERN_API( OSErr )
  278. InstallExtensionTableHandlerProc (ExtensionTableHandlerUPP  extMgrProc,
  279.                                  ExtensionTableHandle *    extTable)                            TWOWORDINLINE(0x7002, 0xAA7D);
  280.  
  281.  
  282. /*
  283.     RemoveExtensionTableHandlerProc
  284.  
  285.     Remove an ExtensionTableUPP. Control is passed back to the default handler.
  286.  
  287.     Parameters:
  288.         extMgrProc            The ExtensionTableUPP to remove.
  289.  
  290.     Results:
  291.         noErr        0        The ExtensionTableUPP was removed.
  292.         paramErr    -50        This ExtensionTableUPP was not installed,
  293.                             or the ExtensionTable no longer matches the
  294.                             original boot ExtensionTable.
  295. */
  296. EXTERN_API( OSErr )
  297. RemoveExtensionTableHandlerProc    (ExtensionTableHandlerUPP  extMgrProc)                        TWOWORDINLINE(0x7003, 0xAA7D);
  298.  
  299.  
  300. #if PRAGMA_STRUCT_ALIGN
  301.     #pragma options align=reset
  302. #elif PRAGMA_STRUCT_PACKPUSH
  303.     #pragma pack(pop)
  304. #elif PRAGMA_STRUCT_PACK
  305.     #pragma pack()
  306. #endif
  307.  
  308. #ifdef PRAGMA_IMPORT_OFF
  309. #pragma import off
  310. #elif PRAGMA_IMPORT
  311. #pragma import reset
  312. #endif
  313.  
  314. #ifdef __cplusplus
  315. }
  316. #endif
  317.  
  318. #endif /* __START__ */
  319.  
  320.